<?php
if (preg_match ("/include/i", $_SERVER['REQUEST_URI'])){

}else{
	require ('include/Smarty/Smarty.class.php');
$smarty = new Smarty ( );
$smarty->template_dir = 'templates/';
$smarty->compile_dir = 'templates_c/';
$smarty->config_dir = 'configs/';
$smarty->cache_dir = 'cache/';
$smarty->left_delimiter = '<{';
$smarty->right_delimiter = '}>';
$smarty->assign("HOST",$_SERVER['HTTP_HOST']);
};
//$database_kiwi = parse_ini_file ( "settings.ini" );
$database_kiwi = parse_ini_file("config.ini");
$link = mysql_connect ( $database_kiwi ['database.hostname'], $database_kiwi ['database.username'], $database_kiwi ['database.password'] );
mysql_select_db ( $database_kiwi ['database.database'] );

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
};

?>